package com.cd.learn.cdlearn.pattern.command;

import java.util.HashMap;
import java.util.Set;

/**
 * 实际的命令
 */
public class OrderFood implements Command{
    //命令的执行者
    private CommandReceive commandReceive;
    //命令的调用者
    private CommandParam commandCaller;

    public OrderFood(CommandReceive commandReceive,CommandParam commandCaller){
        this.commandCaller = commandCaller;
        this.commandReceive = commandReceive;
    }

    @Override
    public void execute() {
        HashMap<String, Integer> map = commandCaller.getMap();
        Set<String> names = map.keySet();

        for (String name : names) {
            Integer integer = map.get(name);
            commandReceive.makeFood(name,integer);
        }
        System.out.println("饭做好了。。。");

    }
}
